//done:在成功构建并且输出了文件后，webpack即将退出时发生
//
class EndWebpackPlugin{
    constructor(doneCallback, failCallback) {
        this.doneCallback = doneCallback
        this.failCallback = failCallback
    }

    apply(compiler) {
        compiler.plugin('done', (stats) => {
            this.doneCallback(stats)
        });
        compiler.plugin('failed', (err) => {
            this.failCallback(err)
        })
    }
}

module.exports = EndWebpackPlugin